
Structure/Allocation of the Harddisk
====================================

Block    Description
----------------------------------------------

        +-----------------------------------+
 0      |   ATARI-kompatible rootblock      | 
        |   (Bootloader/partition-infos)    |
        +-----------------------------------+
 1-3    |   protar partitioninfos           |
        |                                   |
        +-----------------------------------+
 4-23   |   protar driver software          |
        |                                   |
        |                                   |
        +-----------------------------------+
 24-32  |   Room for another rootblocks in  |
        |   'XGM' format                    |
        +-----------------------------------+
 33     |   Partition 0                     |
        .                                   .
        .                                   .
        
 xx     +-----------------------------------+
        |   Partition 1                     |
        .                                   .
        .                                   .
        
        

Rootblock/ATARI partition format (block 0):
===========================================

Offset  Symbol      Size   Description
-----------------------------------------------------------------------------

                            +-----------------------------------------------+
$0000   st_bootload 1W      |   Opcode (BRA.S)                              |
                            +-----------------------------------------------+
$0002   st_magic    1L      |   Magic 'crac'                                |
$0003   st_magic2   1W      |   Magic, Protar-Harddisk: 'HD', other 'SH'    |
$0004   st_reserved 1L      |                                               |
                            +-----------------------------------------------+
$0008   st_bootcode ...     |   The bootload-program                        |
							|                                               |
                            +-----------------------------------------------+
$001E   st_minsecsiz 1W		|   Minimal  sectorsize (for system-buffer)     |
                            +-----------------------------------------------+
$0020   st_mediach  1B		|   Flag for "Media change"-support             |
                            +-----------------------------------------------+
$0022   st_bootcode2 ...    |   The bootload-program                        |
							|                                               |
                            +-----------------------------------------------+
$01C2   st_hdsize   1L      |   Harddisk size in sectors                    |
                            +-----------------------------------------------+
$01C6   st_part0    12B     |   ATARI-partition-entry 0                     |
                            +-----------------------------------------------+
$01D2   st_part1    12B     |   ATARI-partition-entry 1                     |
                            +-----------------------------------------------+
$01DE   st_part2    12B     |   ATARI-partition-entry 2                     |
                            +-----------------------------------------------+
$01EA   st_part3    12B     |   ATARI-partition-entry 3                     |
                            +-----------------------------------------------+
$01FE   st_1234     1W      |   checksum entry to get a $1234 checksum      |
                            +-----------------------------------------------+


<ATARI-partitions-entry>
 ========================

Offset  Symbol      Size   Description
----------------------------------------------------------------------------
 0      stp_flag    1B      $81 boot drive, $01 exists
 1      stp_id      3B      ID like 'GEM', 'IBM' (or 'XGM' entry which points 
                            to another rootblock)
 4      stp_start   1L      Start-Sector of partition
 8      stp_size    1L      Size of partition in sectors


Protar-partition-information-format:
====================================

Block   Offset  Description
------------------------------------------------------

                +-----------------------------------+
    1   $0000   |   Internal branch-opcodes         |
                +-----------------------------------+
    1   $0010   |   Protar-Volume-Info              |
                +-----------------------------------+
    1   $0040   |   Protar-partition-entry    0     |
                +-----------------------------------+
    1   $0070   |   Protar-partition-entry    1     |
                +-----------------------------------+
    1   $00A0   |   Protar-partition-entry    2     |
                +-----------------------------------+
    1   $00D0   |   Protar-partition-entry    3     |
                +-----------------------------------+
    1   $0100   |   Protar-partition-entry    5     |
                +-----------------------------------+
    1   $0130   |   Protar-partition-entry    6     |
                +-----------------------------------+
    1   $0160   |   Protar-partition-entry    7     |
                +-----------------------------------+
    1   $0190   |   Protar-partition-entry    8     |
                +-----------------------------------+
    10  $01C0   |   Protar-partition-entry    9     |
                +-----------------------------------+
    1/2 $01F0   |   Protar-partition-entry    10    |
                +-----------------------------------+
    2   $0020   |   Protar-partition-entry    11    |
                +-----------------------------------+


<Protar-Volume-Info>
 ==================

Offset  Symbol      Size   Description
----------------------------------------------------------------------------
  0     v_magi1     1L      Magic 'V1.0'
  4     v_typ       1W      Device type (2=harddisk,3=cartridge, 4=streamer)
  6     v_state     1W      Device flags (2=Media-Change support needed)
  8     v_size      1L      Capacity in kbytes
 12     v_part      1W      Number of partitions
 14     v_magi2     1W      Magic 'ST'
 16     v_name      13B     Productname (NULL-byte-terminated)
 29     v_magi3     19B		'CRAC GMBH '
 55		v_date		4B		Driver version date, format YYCCMMDD


<Protar-Partition-Eintrge>
 =========================

Offset  Symbol      Size   Description
----------------------------------------------------------------------------
  0     pp_start    1L      Start sector
  4     pp_end      1L      End sector + 1
  8     pp_bsize    1L      Capacity in kbytes
 12     pp_flag     1W      <Protar-Status-Flags> 
 14     pp_typ      3B      ID like 'GEM', 'IBM' etc.
 17     pp_pw       13B     Password (NULL-byte-terminated)
 30     pp_drv      1B      Drive number (2=C, 3=D, ...)
 31     pp_name     13B     Partitionname
 44     pp_bytpsec  1W      Logic sektorsize (512, 1024, ...) 
 44     pp_magic    1W      Magic 'ST' 


<Protar-Status-Flags>
 -------------------

Bit     Symbol      Mask    Description
----------------------------------------------------------------------------
  0     PA_EXIST    $0001   Partition exists
  7     PA_BOOT     $0080   Partition is boot drive
  8     PA_RDONLY   $0100   Partition is write-protected
  9     PA_PASSWD   $0200   Partition is password-protected
 10     PA_FORCE    $0400   Partition is fixed to drive
 11     PA_EXCLUS   $0800   Partition is an exclusive drive
 12     PA_BFORCE   $1000   Partition is a fixed boot drive


Used System Vectors and Variables
======================================

Address     Symbol          Description
----------------------------------------------------------------------------
$84         gemdos_vec      Patch-routine for ACC-bootbug will be installed
$88         aesvdi_vec      will be used during boot phase
$404        etv_critic      will be used for error handling 
$408        etv_term        ^C will be disabled during boot phase
$42A		resvector		In case of a CookieJar installation
							it will be used to clear _cookies on reset.
$43E        flock           Semaphore for HD-access
$446        _bootdev        will be used for boot drive select
$472        hdv_bpb         points to Getbpb()-routine with XBRA 'PRTR'
$476        hdv_rw          points to Rwabs()-routine with XBRA 'PRTR'
$47E        hdv_mediach     points to Mediach()-routine with XBRA 'PRTR'
$484        conterm         key repeat will be disabled during boot phase
$4B2		_bufl			2 pointer to GEMDOS system buffer list
$4BA        _hz_200         used for timer loops
$4C2        _drvbits        Installed drives
$4C6        _dskbufp        Buffer for data transfers to odd addresses
$4F2        _sysbase        Used to get TOS version and language
$516        pun_ptr         Pointer to AHDI 3.0-kompatible structure
$5A0		_cookies		If no CookieJar exists it will be installed
							A cookie "PRTR" will be inserted
